﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title></title>
    <link rel="Stylesheet" href="../ext/resources/css/ext-all.css" />
    <script type="text/javascript" src="../ext/adapter/ext/ext-base-debug.js" charset="UTF-8"></script>
    <script type="text/javascript" src="../ext/ext-all-debug.js" charset="UTF-8"></script>
</head>
<body>
    <script type="text/javascript">
        debugger;
        var action = new Ext.Action({
            text: 'Do something',
            handler: function() {
                Ext.Msg.alert('Click', 'You did something.');
            },
            iconCls: 'do-something'
        });

        var panel = new Ext.Panel({
            title: 'Actions',
            width: 500,
            height: 300,
            tbar: [

                //将action做为一个菜单按钮添加到工具栏
                action, {
                text: 'Action Menu',
                //将action做为文本选择项添加到menu
                menu: [action]
                }
            ],
            items: [
                //由action构造button,添加到panel
                new Ext.Button(action)
            ],
            renderTo: Ext.getBody()
        });

        // 如果这儿setText.当然button/menu/toolbar中的action文本都变了
        //action.setText('Something else');


    
    </script>
</body>
</html>
